package com.lw.lost.daos

import android.content.ContentValues
import android.database.Cursor
import android.database.sqlite.SQLiteDatabase

class InterestDao(private val db: SQLiteDatabase) {
    
    fun insert(userId: Long, education: String, content: String): Long {
        val values = ContentValues().apply {
            put("userId", userId)
            put("education", education)
            put("content", content)
        }
        return db.insert("interests", null, values)
    }

    fun getInterestsByUserId(userId: Long): Cursor {
        return db.query(
            "interests",
            null,
            "userId = ?",
            arrayOf(userId.toString()),
            null,
            null,
            null
        )
    }

    fun updateInterest(interestId: Long, values: ContentValues): Int {
        return db.update(
            "interests",
            values,
            "interestId = ?",
            arrayOf(interestId.toString())
        )
    }
} 